﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using TyMES.Model;
using TyMES.Model.BaseInformation;

namespace TyMES.Model.BaseInformation
{
    /// <summary>
    /// 设备管理
    /// </summary>
	[Table("T_Machines")]
    [SoftKey(nameof(Machine.MachineCode))]
    [Display(Name = "_Model.Machine")]
    public class Machine : BasePoco
    {
        [Display(Name = "_Model._Machine._MachineCode")]
        [Comment("设备编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [CanNotEdit]
        public string MachineCode { get; set; }
        [Display(Name = "_Model._Machine._MachineName")]
        [Comment("设备名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string MachineName { get; set; }
        [Display(Name = "_Model._Machine._Asset")]
        [Comment("资产号")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Asset { get; set; }
        [Display(Name = "_Model._Machine._LineCode")]
        [Comment("设备产线")]
        [NotMapped]
        public Line LineCode { get; set; }
        [Display(Name = "_Model._Machine._LineCode")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("设备产线")]
        public string LineCodeId { get; set; }
        [Display(Name = "_Model._Machine._RatedPower")]
        [Comment("额定功率")]
        public float? RatedPower { get; set; }
        [Display(Name = "_Model._Machine._AtmPressure")]
        [Comment("气压")]
        public float? AtmPressure { get; set; }
        [Display(Name = "_Model._Machine._Voltage")]
        [Comment("电压")]
        public float? Voltage { get; set; }
        [Display(Name = "_Model._Machine._Current")]
        [Comment("电流")]
        public float? Current { get; set; }
        [Display(Name = "_Model._Machine._PersonCode")]
        [Comment("责任人")]
        public string PersonCode { get; set; }
        [Display(Name = "_Model._Machine._MachineStatus")]
        [Comment("设备状态")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public EquipmentStatusEnum? MachineStatus { get; set; }
        [Display(Name = "_Model._Machine._StationCode")]
        [Comment("设备所在工位")]
        [NotMapped]
        public Station StationCode { get; set; }
        [Display(Name = "_Model._Machine._StationCode")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("设备所在工位")]
        public string StationCodeId { get; set; }

	}

}
